<h1 class="sysPageHead">
    <span class="sysPageDot"><img src="__PUBLIC__/images/sysListIcon3.png"><span class="textHide">.</span></span>
    广告管理

</h1>

<div class="iotSysmCon"  style="background:#fff" >
    <div class="searchTop">
        <div class="createReport" style="float:left"><a href="__ROOT__/index.php/Admin/Advertising/add">添加金融广告</a></div>
        <div class="createReport" style="float:left"><a href="__ROOT__/index.php/Admin/Advertising/addGame">添加游戏广告</a></div>
        <form method="get" action="__ROOT__/index.php/Admin/Advertising/index">
            <div class="search floatR">
                <input type="text" name="advertising_name" placeholder="输入广告名称关键字" class="inp" value="{$advertising_name}">
                <input type="submit" value="搜索" class="sub">
            </div>
        </form>

    </div>

    <div class="iotTableList" style="margin-top:0;padding-top:0px;border-top:20px solid #eaedf1">
        <table border="0" cellspacing="0" cellpadding="0" class="reportTable">
            <thead>
            <tr>
                <th width="10%">广告名称</th>
                <th width="25%">广告单价</th>
                <th width="25%">广告消耗报警比例</th>
                <th width="15%">ROI注册与投资转化率</th>
                <th width="15%">操作</th>
            </tr>
            </thead>
            <tbody>
                <foreach name="ads" item="ad">
                    <tr>
                        <td>{$ad['advertising_name']}</td>
                        <td>{$ad['unit_price']}</td>
                        <td>{$ad['alarm_rate']}</td>
                        <td>{$ad['roi']}</td>
                        <td>
                            <a href="__ROOT__/index.php/Admin/Advertising/edit?id={$ad['advertising_id']}" class="checkDetails">编辑</a>&nbsp;&nbsp;
                            <a class="privateLetter" del_url='__ROOT__/index.php/Admin/Advertising/delete?id={$ad["advertising_id"]}' onclick='confirmDel(this);'>删除</a>
                        </td>
                    </tr>
                </foreach>
            </tbody>
        </table>
        <div class="tcdPageCode">{$page}</div>
    </div>

</div>
<script>
    function confirmDel(e){
        if(confirm("确定要删除吗？")){
            var url = $(e).attr('del_url');
            $.ajax({
                url: url,
                type: "get",
                data: {},
                dataType: "json",
                success: function( result ){
                    if ( result.ret == 0 ) {
                        window.location.href = '__ROOT__/index.php/Admin/Advertising/index';
                    } else {
                        alert('删除失败，请重试');
                    }
                },
                error:function()
                {
                    alert('程序出错，请刷新页面后重试');
                }
            });
        }
    }
</script>